package cn.xo68.ide.plugin.common.ui.toolwindow;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.openapi.wm.ToolWindowType;
import com.intellij.ui.content.Content;
import org.jetbrains.annotations.NotNull;

public class ToolSuiteToolWindow implements ToolWindowFactory {

    public static final String TOOL_WINDOW_ID="WxToolSuite";
    public static final String TAB_LOGS = "Log";

    @Override
    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
        addLogTab(project, toolWindow);
        toolWindow.setType(ToolWindowType.DOCKED, null);
    }


    private void addLogTab(Project project, ToolWindow toolWindow) {
        Content logContent = toolWindow.getContentManager().getFactory()
                .createContent(
                        new ToolSuiteLogPanel(toolWindow, project),
                        TAB_LOGS,
                        false);
        toolWindow.getContentManager().addContent(logContent);
    }
}
